#include "stdio.h"
#include <unistd.h>

#define myfile "log.txt"

int main()
{
    _FILE* fp = _fopen(myfile, "a");
    if(fp == NULL)
    {
        perror("fopen");
        return 1;
    }
    
    const char* message = "hello Linux\n";
    int cnt = 10;
    while(cnt)
    {
        _fwrite(fp, message, strlen(message));
        
        sleep(1);
        cnt--;
    }
    
    _fclose(fp);


    return 0;
}
